package com.qf.service.impl;

import com.qf.entity.SelectCourse;
import com.qf.entity.Student;
import com.qf.mapper.SelectCourseMapper;
import com.qf.service.SelectCourseService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * --- 天道酬勤 ---
 *
 * @author Hulboy
 * @date 2024/8/23
 * @desc --- 代码敲烂 月薪过万 ---
 */
@Service
public class SelectCourseServiceImpl implements SelectCourseService {
    @Autowired
    private SelectCourseMapper mapper;

    @Override
    public List<Student> findAll3(Integer cid) {
        return mapper.findAll3(cid);
    }

    @Override
    public List<SelectCourse> findAll2(HashMap<String, String> map) {
        return mapper.findAll2(map);
    }

    @Override
    public List<SelectCourse> findAll(HashMap<String, String> map) {
        return mapper.findAll(map);
    }

    @Override
    public boolean addCourse(SelectCourse course) {
        return mapper.addCourse(course);
    }

    @Override
    public boolean edit(SelectCourse course) {
        return mapper.edit(course);
    }


    @Override
    public boolean deleteById(int id) {
        return mapper.deleteById(id);
    }

    @Override
    public int deletestudent(Integer sid, Integer cid) {
        if (mapper.deletestudent(sid,cid)>0){
            return mapper.updateNum(cid);
        }
        return 0;
    }
}
